/**
 * 正则
 * 这篇讲的很好：https://mp.weixin.qq.com/s/Qqs_EmvIOvjn5ZXe8umwXA
 */
function test(){
    const validateMobile = str => str.replace(/(\d{3})(\d{4})(\d{4})/, (rs, $1, $2, $3) => `${$1}****${$3}`)
    aa = '18812345678'
    a = validateMobile(aa)
    console.log(a);
    
    const validateMobile2 = str => str.replace(/(\d{3})(\d{4})(\d{4})/, (rs, $1, $2, $3) => `${$1}-${$2}-${$3}`)
    a = validateMobile2(aa)
    console.log(a);
    
    const reg = /\D{3}/;
    console.log(reg.test(aa));
    
    const reg2 = /[adgk|aabb]{3}/
    console.log(reg2.test('aad'));
}

// test();

function test2(){
    var str = `
        <kiss-font name="abc" />
        <kiss-font :aa="ffs" name="bcd" />
    `;

    var reg = /<kiss-font\s.*name="(\w+)"/g
    var arr = str.matchAll(reg);
    for(let ele of arr){
        console.log(ele[1])
    }
}

// test2();

function test3(){
    var str = `
        <kiss-font name="abc" />
        <kiss-font :aa="ffs" name="bcd" />
    `;

    var reg = /(?<=(name="))\w+(?=("))/g
    var arr = str.match(reg);
    console.log(arr)
}

test3();